<template>
  <Dialog title="详情" v-model="dialogVisible" width="80%" center>
    <el-card shadow="never">
      <el-descriptions :column="1">
        <el-descriptions-item>
          <template #label>
            <descriptions-item-label label="图库图片名称" />
          </template>
          {{ data.name }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template #label>
            <descriptions-item-label label="图库图片类型" />
          </template>
		   <dict-tag :type="DICT_TYPE.BLIND_BACKGROUND_TYPE" :value="data.type" />
        </el-descriptions-item>
        <el-descriptions-item>
          <template #label>
            <descriptions-item-label label="图库图片" />
          </template>
		  <el-image
		    class="h100px w160px rd"
		    :src="data.url"
		    :zoom-rate="1.2"
		    :max-scale="7"
		    :min-scale="0.2"
		    :preview-src-list="[data.url]"
		    :initial-index="4"
		    fit="cover"
		  />
        </el-descriptions-item>
      </el-descriptions>
    </el-card>
  </Dialog>
</template>
<script setup lang="ts">
	
import * as BackgroundApi from '@/api/blind/background'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'


const dialogVisible = ref(false) // 弹窗的是否展示
const data = ref<BackgroundApi.BackgroundBaseVO>({} as BackgroundApi.BackgroundBaseVO)

/** 打开弹窗 */
const open = async (id?: number) => {
  dialogVisible.value = true
  // 修改时，设置数据
  if (id) {
    data.value = await BackgroundApi.getBackground(id)
  }
}
defineExpose({ open }) // 提供 open 方法，用于打开弹
</script>
<style scoped lang="scss">
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
</style>
